// index.js
import HYRequest from '@/servers/request'

// 获取学生信息 by id
export function getList(studentId) {
    return HYRequest.post({
        url: '/student/selectById/'+studentId,
    })
}


// 获取学生信息 by name
export function getBystudentName(studentName) {
    return HYRequest.post({
        url: '/student/selectByName/'+studentName,
    })
}

// 获取学生信息 by dormId
export function getBydormId(dormId) {
    return HYRequest.post({
        url: '/student/selectByDormId/'+dormId,
    })
}


// 获取所有列表
export function getAllList() {
    return HYRequest.get({
        url: '/student/all',
    })
}

// 修改学生信息
export function upData(form) {
    return HYRequest.post({
        url: '/student/updata',
        data: form
    })
}

//添加学生信息
export function addData(form) {
    return HYRequest.post({
        url: '/student/insert',
        data: form
    })
}

//获取宿舍列表
export function getDormList() {
    return HYRequest.get({
        url: '/Dormitory/all',
    })
}

//修改宿舍信息
export function upDorm(form) {
    return HYRequest.post({
        url: '/Dormitory/updata',
        data: form
    })
}

//添加宿舍信息
export function addDor(dormitoryId) {
    return HYRequest.post({
        url: '/Dormitory/insert/'+ dormitoryId,
    })
}

//删除学生
export function deleteStudent(studentId) {
    return HYRequest.post({
        url: '/student/del/'+ studentId,
    })
}

//删除宿舍
export function deleteDorm(dormitoryId) {
    return HYRequest.post({
        url: '/Dormitory/del/'+ dormitoryId,
    })
}

//获取所有信息
export function getAll() {
    return HYRequest.get({
        url: '/get/all',
    })
}

//查找宿舍
export function getDorm(dormitoryId) {
    return HYRequest.post({
        url: '/Dormitory/selectById/'+ dormitoryId,
    })
}